package com.alogic.terminal.ssh;

import ch.ethz.ssh2.Connection;
import com.anysoft.util.Factory;

import java.io.IOException;

/**
 * 验证器
 *
 * @version 1.6.12.44 [20191023 duanyy] <br>
 * - 增加支持证书登录 <br>
 */
public interface Authenticator {
    /**
     * 进行验证
     * @param conn ssh链接
     * @return 是否成功
     */
    public boolean authenticate(Connection conn) throws IOException;

    /**
     * 工厂类
     */
    public static class TheFactory extends Factory<Authenticator>{
        public String getClassName(String _module) {
            if (_module.indexOf('.') < 0){
                return "com.alogic.terminal.ssh.auth." + _module;
            }
            return _module;
        }
    }
}
